package com.roger.cmdkit.demo;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class GuiMenu  extends JFrame {
    private JFrame jf = new JFrame();

    JMenuBar jmb;

    JMenu menu1, menu2, menu3, menu4, menu5;
    JMenuItem item1,item2, item3, item4, item5, item6;
    JMenu add;
    JMenuItem file, project;

    private JToolBar jtb;
    JButton jb1, jb2, jb3, jb4, jb5, jb6;

    JTextArea jta;



    public static void main(String[] args) {
        new GuiMenu().createGUI();
    }

    private void createGUI(){

        jmb = new JMenuBar();
        menu1 = new JMenu("File");
        menu1.setMnemonic('F');
        menu2 = new JMenu("Edit");
        menu2.setMnemonic('E');
        menu3 = new JMenu("View");
        menu3.setMnemonic('V');
        menu4 = new JMenu("Run");
        menu4.setMnemonic('R');
        menu5 = new JMenu("Help");
        menu5.setMnemonic('H');

        add = new JMenu("New");
        file = new JMenuItem("New File");
        project = new JMenuItem("New Project");

        item1 = new JMenuItem("Open", new ImageIcon(""));
        item2 = new JMenuItem("Save", new ImageIcon(""));
        item2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK));
        item3 = new JMenuItem("Save as", new ImageIcon(""));
        item4 = new JMenuItem("Settings", new ImageIcon(""));
        item5 = new JMenuItem("Print...", new ImageIcon(""));
        item6 = new JMenuItem("Exit", new ImageIcon(""));

        add.add(file);
        add.add(project);
        menu1.add(add);
        menu1.add(item1);
        menu1.add(item2);
        menu1.add(item3);
        menu1.addSeparator();
        menu1.add(item4);
        menu1.add(item5);
        menu1.addSeparator();
        menu1.add(item6);

        jmb.add(menu1);
        jmb.add(menu2);
        jmb.add(menu3);
        jmb.add(menu4);
        jmb.add(menu5);
        jf.setJMenuBar(jmb);


        jtb = new JToolBar();
        jb1 = new JButton(new ImageIcon("C:\\Users\\admin\\Desktop\\11.png"));
        jb1.setToolTipText("New");
        jb2 = new JButton(new ImageIcon("C:\\Users\\admin\\Desktop\\11.png"));
        jb2.setToolTipText("Open");
        jb3 = new JButton(new ImageIcon("C:\\Users\\admin\\Desktop\\11.png"));
        jb3.setToolTipText("View");
        jb4 = new JButton(new ImageIcon("C:\\Users\\admin\\Desktop\\11.png"));
        jb4.setToolTipText("Build");
        jb5 = new JButton(new ImageIcon("C:\\Users\\admin\\Desktop\\11.png"));
        jb5.setToolTipText("Run");
        jb6 = new JButton(new ImageIcon("C:\\Users\\admin\\Desktop\\11.png"));
        jb6.setToolTipText("Help");
        jtb.add(jb1);
        jtb.add(jb2);
        jtb.add(jb3);
        jtb.add(jb4);
        jtb.add(jb5);
        jtb.add(jb6);
        jf.add(jtb, BorderLayout.NORTH);

        jta = new JTextArea();
        JScrollPane jsp = new JScrollPane(jta);
        jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        jf.add(jsp);

        jf.setTitle("Test");
        jf.setSize(1200, 900);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setVisible(true);


        item6.addActionListener(new GuiListener());

    }



}
